<template>
  <div>
    <div class="crumbs">
      <el-breadcrumb separator="/">
        <el-breadcrumb-item> <i class="el-icon-shopping-bag-2"></i> 投资人员 </el-breadcrumb-item>
      </el-breadcrumb>
    </div>
    <div class="container">
      <div class="handle-box">
        <el-button type="primary" class="handle-del mr10" @click="addClick">新增</el-button>
        <el-date-picker class="mr10" type="daterange" range-separator="-" start-placeholder="开始日期" end-placeholder="结束日期" value-format="yyyy-MM-dd"
                        v-model="query.time">
        </el-date-picker>
        <el-input placeholder="请输入产品名称查询" class="handle-input mr10" v-model="query.souVal"></el-input>
        <el-button type="primary" icon="el-icon-search">搜索</el-button>
      </div>
      <el-table :data="tableData" border class="table" style="width: 100%" ref="multipleTable" header-cell-class-name="table-header"
                @selection-change="SelectionChange">
        <el-table-column type="selection" width="55" align="center"></el-table-column>
        <el-table-column type="index" :index="tableIndex" label="序号" width="55" align="center"></el-table-column>
        <el-table-column prop="name" label="姓名"></el-table-column>
        <el-table-column prop="name" label="电话"></el-table-column>
        <el-table-column prop="name" label="关注领域"></el-table-column>
        <el-table-column fixed="right" label="操作" width="200" align="center">
          <template slot-scope="scope">
            <el-button type="text" icon="el-icon-edit" class="red">编辑</el-button>
            <el-button type="text" icon="el-icon-delete" class="red">删除</el-button>
          </template>
        </el-table-column>
      </el-table>
      <div class="pagination">
        <el-pagination background layout="total, prev, pager, next" :current-page="query.page" :page-size="query.limit" :total="page.totalCount"
                       :pager-count="5" @current-change="PageChange" @prev-click="PageChange" @next-click="PageChange"></el-pagination>
      </div>
    </div>
    <el-dialog title="投资人信息" :visible.sync="dialogData.dialogVisible" width="30%">
      <el-form ref="form" :model="dialogData.form" label-width="90px">
        <el-form-item label="类别">
          <el-radio-group v-model="dialogData.form.resource">
            <el-radio label="个人"></el-radio>
            <el-radio label="企业"></el-radio>
          </el-radio-group>
        </el-form-item>
        <el-form-item label="姓名">
          <el-input v-model="dialogData.form.name"></el-input>
        </el-form-item>
        <el-form-item label="电话">
          <el-input v-model="dialogData.form.name"></el-input>
        </el-form-item>
        <el-form-item label="所在地区">
          <el-select v-model="dialogData.form.region" placeholder="请选择所在地区" style="width:100%;">
            <el-option label="北京" value="shanghai"></el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="可投资金额">
          <el-input v-model="dialogData.form.name"></el-input>
        </el-form-item>
        <el-form-item label="资金来源">
          <el-input v-model="dialogData.form.name"></el-input>
        </el-form-item>
        <el-form-item label="企业名称">
          <el-input v-model="dialogData.form.name"></el-input>
        </el-form-item>
        <el-form-item label="企业地址">
          <el-input v-model="dialogData.form.name"></el-input>
        </el-form-item>
        <el-form-item label="关注领域">
          <el-checkbox-group v-model="dialogData.form.type">
            <el-checkbox label="IT互联网" name="type"></el-checkbox>
            <el-checkbox label="农业" name="type"></el-checkbox>
            <el-checkbox label="线下主题活动" name="type"></el-checkbox>
            <el-checkbox label="单纯品牌曝光" name="type"></el-checkbox>
          </el-checkbox-group>
        </el-form-item>
        <el-form-item label="">
          <el-checkbox-group v-model="dialogData.form.type">
            <el-checkbox label="" name="type">我已阅读并同意<el-link type="primary">《资金证明协议》</el-link>
              <el-link type="primary">《隐私协议》</el-link>
            </el-checkbox>
          </el-checkbox-group>
        </el-form-item>
      </el-form>
      <span slot="footer" class="dialog-footer">
        <el-button @click="dialogData.dialogVisible = false">取 消</el-button>
        <el-button type="primary" @click="addClickSub">确 定</el-button>
      </span>
    </el-dialog>
  </div>
</template>

<script>
import { investUserGetList } from "../../../api/index";
export default {
  data() {
    return {
      listLoad: false,
      query: {
        page: 1,
        limit: 10,
        time: [],
        souVal: '',
      },
      tableData: [],
      page: {
        totalCount: 100
      },
      dialogData: {
        dialogVisible: false,
        form: {
          type: []
        }
      }
    };
  },
  created() {
    this.getList();
  },
  methods: {
    //获取列表数据
    getList() {
      this.listLoad = true;
      let query = {
        current: this.query.page,
        beginTime: this.query.time[0],
        endTime: this.query.time[1],
        piName: this.query.souVal,
        limit: this.query.limit
      }
      investUserGetList(query).then((res) => {
        this.listLoad = false;
        if (res.code == 0) {
          // this.tableData = res.investorList;
        } else {
          this.$message(res.msg);
        }
      })
    },
    //序号
    tableIndex(index) {
      return (this.query.page - 1) * this.query.limit + index + 1;
    },
    //翻页
    PageChange(num) { },
    //选中
    SelectionChange() { },
    //新增
    addClick() {
      this.dialogData.dialogVisible = true;
    },
    //新增提交
    addClickSub() {

    }
  }
};
</script>

<style scoped>
.handle-input {
    width: 300px;
    display: inline-block;
}
</style>
